package com.zxj.controller;

import com.seventh.common.pojo.R;
import com.zxj.pojo.entity.TbCarTypeConfigDetails;
import com.zxj.pojo.vo.ConfigVo;

import com.zxj.service.CarConfigService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @program: clms-fifth
 * @description:
 * @author: 张修杰
 * @create: 2021-07-24 11:05
 **/
@RestController
@RequestMapping("lease/carConfig")

public class CarConfigController {
    @Resource
    CarConfigService carConfigService;
    @ApiOperation(value = "初始化汽车查询信息")
    @PostMapping("initCarConfigTable/{currentPage}/{pageSize}")
    public R initCarConfigTable(@PathVariable Integer currentPage,
                                @PathVariable Integer pageSize,
                                @RequestBody ConfigVo configVo){
        return carConfigService.findAllCarConfigPage(currentPage,pageSize,configVo);
    }
    @ApiOperation(value = "修改汽车信息")
    @PutMapping("updateCarConfigById")
    public R updateCarConfigById(@RequestBody TbCarTypeConfigDetails tbCarTypeConfigDetails){
        return carConfigService.updateCarConfigById(tbCarTypeConfigDetails);
    }

    @ApiOperation(value = "修改回显 汽车信息")
    @GetMapping("selectCarConfigById/{id}")
    public R selectCarConfigById(@PathVariable String id){
        return carConfigService.selectCarConfigById(id);
    }
    @ApiOperation(value = "新增汽车信息")
    @PutMapping("insertCarConfig")
    public R insertCarConfig(@RequestBody TbCarTypeConfigDetails tbCarTypeConfigDetails){
        return carConfigService.insertCarConfig(tbCarTypeConfigDetails);
    }
    @ApiOperation(value = "删除汽车信息")
    @GetMapping("deleteCarConfig/{id}")
    public R deleteCarConfig(@PathVariable String id){
        return carConfigService.deleteCarConfig(id);
    }
    @ApiOperation(value = "汽车品牌信息")
    @GetMapping("selectAllCarConfig")
    public R selectAllCarConfig(){ return carConfigService.selectAllCarConfig();}
}
